#ifndef POSITIONLOOP_H
#define POSITIONLOOP_H

#include"mcloop.hpp"

//enum ESTVEL_METHOD
//{
//    ENUM_DIRECT_DIFF,
//    ENUM_DIFF_FILTER,
//    ENUM_EST_END
//};

class PositionLoop: public McLoop
{
private:
    double ts;
    double kp;
    int rcTime;
    int filterOut;
    int lastPos;
    double velEst;
    double diffN;
public:
    PositionLoop(double _ts);
    virtual int loopOut(int refer, int current);
    virtual void initPidController_parallel(int initValue, double _kp, double _ki=0.0, double _kd=0.0);
    virtual int getPidOut_int(int refer, int current) const;
    virtual double getPidOut_double(int refer, int current) const;
    virtual ~PositionLoop();
    void initVelEst(double _diffN, double initVel=0.0);
    double velEstimate(int Pos);
    void initRcFilter(int time, int initValue);
    int getRcFilterOut(int inPuls);
};

#endif // POSITIONLOOP_H
